package cn.szh.dao;

import cn.szh.domain.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import java.util.List;

public interface PermissionDao {
    @Select("select * from permission where id in(select permissionId from role_permission where roleId=#{rid})")
    List<Permission> findPermissionsByRid(Integer rid);
    @Select("select * from permission")
    List<Permission> findAll();
    @Insert("insert into permission(permissionName,url) values(#{permissionName},#{url})")
    void save(@Param("permissionName") String permissionName, @Param("url") String url);
    @Select("select * from permission where id=#{pid}")
    Permission findByPid(Integer pid);
    @Delete("delete from permission where id=#{id}")    //DELETE FROM 表名称 WHERE 列名称 = 值
    void delete(Integer id);
}
